﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using RayD.Core;

namespace RayD.Repository.Entites.SystemModule
{
    [Table("BASE_AUTHORIZE")]
    public class AuthorizeEntity
    {
        #region 实体成员
        /// <summary>
        /// 模块按钮主键
        /// </summary>
        /// <returns></returns>
        [Key]
        [Column("B_AUTHORIZEID")]
        public string B_AuthorizeId { get; set; }
        /// <summary>
        /// 对象分类:1-角色2-用户
        /// </summary>
        /// <returns></returns>
        [Column("B_OBJECTTYPE")]
        public int? B_ObjectType { get; set; }
        /// <summary>
        /// 对象主键
        /// </summary>
        /// <returns></returns>
        [Column("B_OBJECTID")]
        public string B_ObjectId { get; set; }
        /// <summary>
        /// 项目类型:1-菜单2-按钮3-视图
        /// </summary>
        /// <returns></returns>
        [Column("B_ITEMTYPE")]
        public int? B_ItemType { get; set; }
        /// <summary>
        /// 项目主键
        /// </summary>
        /// <returns></returns>
        [Column("B_ITEMID")]
        public string B_ItemId { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        /// <returns></returns>
        [Column("B_CREATEDATE")]
        public DateTime? B_CreateDate { get; set; }
        /// <summary>
        /// 创建用户主键
        /// </summary>
        /// <returns></returns>
        [Column("B_CREATEUSERID")]
        public string B_CreateUserId { get; set; }
        /// <summary>
        /// 创建用户
        /// </summary>
        /// <returns></returns>
        [Column("B_CREATEUSERNAME")]
        public string B_CreateUserName { get; set; }
        #endregion

        #region 扩展操作
        /// <summary>
        /// 新增调用
        /// </summary>
        public void Create()
        {
            this.B_AuthorizeId = Guid.NewGuid().ToString();
            this.B_CreateDate = DateTime.Now.ToCstTime();
            UserInfo userInfo = AuthenticationHelper.LoginUserInfo;
            this.B_CreateUserId = userInfo.userId;
            this.B_CreateUserName = userInfo.realName;
        }
        /// <summary>
        /// 编辑调用
        /// </summary>
        public void Modify()
        {
        }
        #endregion

        #region 扩展属性

        #endregion
    }
}
